#ifndef GraphicManager_h
#define GraphicManager_h
#include <Windows.h>
#include "../Utility/Singleton.h"


static const unsigned kuiConsoleDimX = 80;
static const unsigned kuiConsoleDimY = 25;
static const unsigned kuiConsoleArea = kuiConsoleDimX * kuiConsoleDimY;

// Color Definition
enum eColor {
	eBlack = 0,
	eBlue,
	eGreen,
	eAqua,
	eRed,
	ePurple,
	eYellow,
	eWhite,
	eGrey,
	eLightBlue,
	eLightGreen,
	eLightAqua,
	eLightRed,
	eLightPurple,
	eLightYellow,
	eLightWhite
};

class cGraphicManager : public cSingleton <cGraphicManager> {
public:
	friend class cSingleton <cGraphicManager>;
	// Initialize the Graphic Manager
	void Init();
	// Deinitialize the Graphic Manager
	void DeInit();

	// Manage Buffer
	void WriteChar(unsigned luiX, unsigned luiY, char lChar);
	void WriteChars(unsigned luiX, unsigned luiY, const char* lacStr, unsigned luiLen);
	void WriteChars(unsigned luiX, unsigned luiY, const char* lacStr);

	// Manage Color
	void SetColor(eColor leFore, eColor leBack);
	void SetForegroundColor(eColor leFore);
	void SetBackgroundColor(eColor leColor );

	// Manage thge buffer
	void SwapBuffer();
	void ClearBuffer();

	void ShowTheCursor(bool lbShow);
protected:
	cGraphicManager() {;} // Protected contructor

private:
	char macBackBuffer[kuiConsoleArea];
	unsigned char macColorBuffer[kuiConsoleArea];
	unsigned char mcCurrentColour;
	HANDLE mHandle;

};
#endif